package com.huayue.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.alibaba.fastjson.support.spring.FastJsonJsonView;
import com.huayue.annotation.LogAnno;
import com.huayue.entity.Housekeep;
import com.huayue.service.HousekeepService;
import com.huayue.util.PageHelper;

/**
 * 房务信息
 *
 */
@Controller
@RequestMapping("/housekeep")
public class HousekeepController {

    @Autowired
    HousekeepService svc;

    BaseController bc = new BaseController();

    @LogAnno(operateType = "添加-房务信息")
    @RequestMapping("/add")
    public ModelAndView add(Housekeep housekeep) {
        return bc.add(svc, housekeep);
    }

    @LogAnno(operateType = "修改-房务信息")
    @RequestMapping("/update")
    public ModelAndView update(Housekeep housekeep) {
        return bc.update(svc, housekeep);
    }

    @LogAnno(operateType = "删除-房务信息")
    @RequestMapping("/delete")
    public ModelAndView delete(Housekeep housekeep) {
        return bc.delete(svc, housekeep);
    }

    @RequestMapping("/findOne")
    public ModelAndView findOne(Housekeep housekeep) {
        return bc.findOne(svc, housekeep);
    }

    @RequestMapping("/findPage")
    public ModelAndView findPage(PageHelper page, Housekeep housekeep) {
        return bc.findPage(svc, page, housekeep, housekeep.getName());
    }

    @RequestMapping("/toAdd")
    public ModelAndView toAdd() {
        FastJsonJsonView view = new FastJsonJsonView();
        view.addStaticAttribute("department", svc.findDepartment());
        return new ModelAndView(view);
    }

}
